package com.yaorange.web.controller.nongjt;

import java.util.List;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.yaorange.common.annotation.Log;
import com.yaorange.common.core.controller.BaseController;
import com.yaorange.common.core.domain.AjaxResult;
import com.yaorange.common.enums.BusinessType;
import com.yaorange.nongjt.domain.NjtProductionInfo;
import com.yaorange.nongjt.service.INjtProductionInfoService;
import com.yaorange.common.utils.poi.ExcelUtil;
import com.yaorange.common.core.page.TableDataInfo;

/**
 * 开具数量统计Controller
 * 
 * @author hzliu
 * @date 2025-09-27
 */
@RestController
@RequestMapping("/nongjt/info")
public class NjtProductionInfoController extends BaseController
{
    @Autowired
    private INjtProductionInfoService njtProductionInfoService;

    /**
     * 查询开具数量统计列表
     */
    @PreAuthorize("@ss.hasPermi('nongjt:info:list')")
    @GetMapping("/list")
    public TableDataInfo list(NjtProductionInfo njtProductionInfo)
    {
        startPage();
        List<NjtProductionInfo> list = njtProductionInfoService.selectNjtProductionInfoList(njtProductionInfo);
        return getDataTable(list);
    }

    /**
     * 导出开具数量统计列表
     */
    @PreAuthorize("@ss.hasPermi('nongjt:info:export')")
    @Log(title = "开具数量统计", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, NjtProductionInfo njtProductionInfo)
    {
        List<NjtProductionInfo> list = njtProductionInfoService.selectNjtProductionInfoList(njtProductionInfo);
        ExcelUtil<NjtProductionInfo> util = new ExcelUtil<NjtProductionInfo>(NjtProductionInfo.class);
        util.exportExcel(response, list, "开具数量统计数据");
    }

    /**
     * 获取开具数量统计详细信息
     */
    @PreAuthorize("@ss.hasPermi('nongjt:info:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(njtProductionInfoService.selectNjtProductionInfoById(id));
    }

    /**
     * 新增开具数量统计
     */
    @PreAuthorize("@ss.hasPermi('nongjt:info:add')")
    @Log(title = "开具数量统计", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody NjtProductionInfo njtProductionInfo)
    {
        return toAjax(njtProductionInfoService.insertNjtProductionInfo(njtProductionInfo));
    }

    /**
     * 修改开具数量统计
     */
    @PreAuthorize("@ss.hasPermi('nongjt:info:edit')")
    @Log(title = "开具数量统计", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody NjtProductionInfo njtProductionInfo)
    {
        return toAjax(njtProductionInfoService.updateNjtProductionInfo(njtProductionInfo));
    }

    /**
     * 删除开具数量统计
     */
    @PreAuthorize("@ss.hasPermi('nongjt:info:remove')")
    @Log(title = "开具数量统计", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(njtProductionInfoService.deleteNjtProductionInfoByIds(ids));
    }
}
